package Test;

import Ctr.ProductCtr;
import DB.ProductDB;
import Model.Product;
import org.junit.Test;
import static org.junit.Assert.fail;


public class ProductCtrTest {
    @Test
    public void testFindProduct() throws Exception {
        ProductCtr productCtr = new ProductCtr();

        Product product = productCtr.findProduct("Cowboy", false);

        if(product != null){
            System.out.println("I foundeth it! - Success");
        }
        else{
            fail("Twas not found man");
        }
    }

    @Test
    public void testInsertProduct() throws Exception {
        ProductDB productDB = new ProductDB();
        Product product = new Product(1, "Svin", 2, 3, 4, "Swe", 15, "GunReplicas", 1);
        int rc = productDB.insertProduct(product);

        if (rc == 1){
            System.out.println("Insertion successful. Your woman is happy!");
        }
        else{
            fail("Fite me irl");
        }
    }
}
